package com.micro.school.system.utils;

import com.micro.school.system.domain.StudentInfo;
import com.micro.school.system.domain.vo.StudentInfoVo;

import java.util.List;

public class StudentInfoStatusUtil {
    /**
     * 处理学生信息列表，为状态字段赋值中文含义
     * @param list 学生信息列表
     */
    public static void processStudentInfoNewList(List<StudentInfoVo> list) {
        if (list != null && !list.isEmpty()) {
            for (StudentInfoVo studentInfo : list) {
                setStudentInfoNewStatusLabels(studentInfo);
            }
        }
    }

    /**
     * 处理学生信息列表，为状态字段赋值中文含义
     * @param list 学生信息列表
     */
    public static void processStudentInfoList(List<StudentInfo> list) {
        if (list != null && !list.isEmpty()) {
            for (StudentInfo studentInfo : list) {
                setStudentInfoStatusLabels(studentInfo);
            }
        }
    }

    /**
     * 为学生信息的状态字段赋值中文含义
     * @param studentInfo 学生信息对象
     */
    public static void setStudentInfoNewStatusLabels(StudentInfoVo studentInfo) {
        if (studentInfo == null) {
            return;
        }
        // 设置性别中文含义
        if (studentInfo.getSex() != null) {
            switch (studentInfo.getSex().intValue()) {
                case 0:
                    studentInfo.setSexType("女");
                    break;
                case 1:
                    studentInfo.setSexType("男");
                    break;
                default:
                    studentInfo.setSexType("未知");
                    break;
            }
        }

        // 设置报名状态中文含义
        if (studentInfo.getSignStatus() != null) {
            switch (studentInfo.getSignStatus().intValue()) {
                case 1:
                    studentInfo.setSignStatusType("预报名成功");
                    break;
                case 2:
                    studentInfo.setSignStatusType("已完善信息");
                    break;
                case 3:
                    studentInfo.setSignStatusType("账单已缴费");
                    break;
                case 4:
                    studentInfo.setSignStatusType("缴费已退款");
                    break;
                case 5:
                    studentInfo.setSignStatusType("取消报名");
                    break;
                default:
                    studentInfo.setSignStatusType("未知状态");
                    break;
            }
        }

        // 设置学生状态中文含义
        if (studentInfo.getGraduate() != null) {
            switch (studentInfo.getGraduate().intValue()) {
                case 0:
                    studentInfo.setGraduateType("未入学");
                    break;
                case 1:
                    studentInfo.setGraduateType("在校");
                    break;
                case 2:
                    studentInfo.setGraduateType("休学");
                    break;
                case 3:
                    studentInfo.setGraduateType("请假");
                    break;
                case 4:
                    studentInfo.setGraduateType("退学");
                    break;
                case 5:
                    studentInfo.setGraduateType("毕业");
                    break;
                default:
                    studentInfo.setGraduateType("未知状态");
                    break;
            }
        }
    }

    /**
     * 为学生信息的状态字段赋值中文含义
     * @param studentInfo 学生信息对象
     */
    public static void setStudentInfoStatusLabels(StudentInfo studentInfo) {
        if (studentInfo == null) {
            return;
        }
        // 设置性别中文含义
        if (studentInfo.getSex() != null) {
            switch (studentInfo.getSex().intValue()) {
                case 0:
                    studentInfo.setSexType("女");
                    break;
                case 1:
                    studentInfo.setSexType("男");
                    break;
                default:
                    studentInfo.setSexType("未知");
                    break;
            }
        }

        // 设置报名状态中文含义
        if (studentInfo.getSignStatus() != null) {
            switch (studentInfo.getSignStatus().intValue()) {
                case 1:
                    studentInfo.setSignStatusType("预报名成功");
                    break;
                case 2:
                    studentInfo.setSignStatusType("已完善信息");
                    break;
                case 3:
                    studentInfo.setSignStatusType("账单已缴费");
                    break;
                case 4:
                    studentInfo.setSignStatusType("缴费已退款");
                    break;
                case 5:
                    studentInfo.setSignStatusType("取消报名");
                    break;
                default:
                    studentInfo.setSignStatusType("未知状态");
                    break;
            }
        }

        // 设置学生状态中文含义
        if (studentInfo.getGraduate() != null) {
            switch (studentInfo.getGraduate().intValue()) {
                case 0:
                    studentInfo.setGraduateType("未入学");
                    break;
                case 1:
                    studentInfo.setGraduateType("在校");
                    break;
                case 2:
                    studentInfo.setGraduateType("休学");
                    break;
                case 3:
                    studentInfo.setGraduateType("请假");
                    break;
                case 4:
                    studentInfo.setGraduateType("退学");
                    break;
                case 5:
                    studentInfo.setGraduateType("毕业");
                    break;
                default:
                    studentInfo.setGraduateType("未知状态");
                    break;
            }
        }
    }
}
